package cn.wolfcode.trip.base.domain;

import com.alibaba.fastjson.JSON;
import lombok.*;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class HotelDetail extends BaseDomain {


    public static final Integer STATE_FULL = 0; //满房
    public static final Integer STATE_HAVEL = 1; //预订


    private Hotel hotel;

    private String name;

    private String coverUrl;

    private String price;

    private Integer state;

    public String getStateName() {
        String str = "";
        if (state == STATE_FULL) {
            str = "满房";
        } else if (state == STATE_HAVEL) {
            str = "预订";
        }
        return str;
    }

    public Object getJson() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("name", name);
        map.put("coverUrl", coverUrl);

        if (hotel != null) {
            map.put("hotelId", hotel.getId());
            map.put("hotelName", hotel.getName());
        }

        map.put("price", price);
        map.put("state", state);

        return JSON.toJSONString(map);
    }





}